package com.zlzxm.shoesmarket.view.window;

import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;

import com.zlzxm.shoesmarket.R;
import com.zlzxm.shoesmarket.util.ZViewHelp;
import com.zlzxm.shoesmarket.view.window.wheelpick.ADOption;

/**
 * CREATE BY zlzxm ON 4/26/21
 */
public class WindowCalculateShare extends DialogFragment implements View.OnClickListener {


    public static WindowCalculateShare newInstance() {

        Bundle args = new Bundle();

        WindowCalculateShare fragment = new WindowCalculateShare();
        fragment.setArguments(args);
        return fragment;
    }

    private WindowCalculateShare() {
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {

        Dialog dialog = new Dialog(getContext());

        dialog.setContentView(R.layout.window_calculate_share);

        dialog.setCanceledOnTouchOutside(false);

        Window window = dialog.getWindow();

        window.setBackgroundDrawable(new ColorDrawable(0));

        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);

        window.setLayout(-1,-2 );


        ZViewHelp.setOnClickListener(dialog,R.id.rlRoot,this);
        ZViewHelp.setOnClickListener(dialog,R.id.llShareWX,this);
        ZViewHelp.setOnClickListener(dialog,R.id.llToMarket,this);
        ZViewHelp.setOnClickListener(dialog,R.id.llGeneratePic,this);



        return dialog;
    }

    @Override
    public void onClick(View v) {

        if (v.getId() == R.id.rlRoot){

            dismiss();

        }else if (v.getId() == R.id.llShareWX){

            shareWx();

        }else if (v.getId() == R.id.llToMarket){

            toMarket();

        }else if (v.getId() == R.id.llGeneratePic){

            generatePic();

        }


    }


    private void shareWx(){

        dismiss();
    }


    private void toMarket(){

        dismiss();
    }

    private void generatePic(){

        dismiss();
    }
}
